<!DOCTYPE HTML PUBdtC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>oscP5 : : OscBundle : : setTimetag ( )</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
	<div id="header">
	<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
	</div>
	<div class="content">
	<h1><a href="index.htm">oscP5</a> / <a href="OscBundle_class_OscBundle.htm">OscBundle</a> / setTimetag( )</h1>
		<div class="separator">
		<dl><dt class="key">name</dt><dd class="value">setTimetag ( )</dd></dl>
		</div>
		<dl><dt class="key">description</dt><dd class="value">set the timetag of an osc bundle. timetags are used to synchronize events and
 execute events at a given time in the future or immediately. timetags can
 only be set for osc bundles, not for osc messages. oscP5 supports receiving
 timetags, but does not queue messages for execution at a set time.&nbsp;</dd></dl>
		
		<div class="toggleList example">
			<dl><dt onclick="toggle(this)"><span>+</span>Examples</dt>
			<dd><pre>/**
 * oscP5bundle by andreas schlegel
 * an osc broadcast server.
 * example shows how to create and send osc bundles. 
 * oscP5 website at http://www.sojamo.de/oscP5
 */

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;

void setup() {
  size(400,400);
  frameRate(25);
  /* start oscP5, listening for incoming messages at port 12000 */
  oscP5 = new OscP5(this,12000);
  
  /* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
   * an ip address and a port number. myRemoteLocation is used as parameter in
   * oscP5.send() when sending osc packets to another computer, device, 
   * application. usage see below. for testing purposes the listening port
   * and the port of the remote location address are the same, hence you will
   * send messages back to this sketch.
   */
  myRemoteLocation = new NetAddress("127.0.0.1",12000);
}


void draw() {
  background(0);  
}


void mousePressed() {
  /* create an osc bundle */
  OscBundle myBundle = new OscBundle();
  
  /* createa new osc message object */
  OscMessage myMessage = new OscMessage("/test");
  myMessage.add("abc");
  
  /* add an osc message to the osc bundle */
  myBundle.add(myMessage);
  
  /* reset and clear the myMessage object for refill. */
  myMessage.clear();
  
  /* refill the osc message object again */
  myMessage.setAddrPattern("/test2");
  myMessage.add("defg");
  myBundle.add(myMessage);
  
  myBundle.setTimetag(myBundle.now() + 10000);
  /* send the osc bundle, containing 2 osc messages, to a remote location. */
  oscP5.send(myBundle, myRemoteLocation);
}



/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
  /* print the address pattern and the typetag of the received OscMessage */
  print("### received an osc message.");
  print(" addrpattern: "+theOscMessage.addrPattern());
  print(" typetag: "+theOscMessage.typetag());
  println(" timetag: "+theOscMessage.timetag());
}
</pre></dd>
			</dl>
		</div>
		
		<div class="separator">
		<dl><dt class="key">Syntax</dt><dd class="value"><pre>setTimetag(theTime);
</pre></dd></dl>
		</div>
		<div class="separator">
		
   <dl><dt class="key">parameters</dt><dd class="value"><span class="parameters">theTime</span><span class="parameters">long</span><span class="clear">&nbsp;</span></dd>
</dl>
		<br /><br />
		</div>
		<div class="separator">
		<dl><dt class="key">Returns</dt><dd class="value">None</dd></dl>

		</div>
		<div class="separator">
		<dl><dt class="key">Usage</dt><dd class="value">Web & Application</dd></dl>
		</div>
		<div class="separator">
		<dl><dt class="key">Related</dt><dd class="value"><ul></ul></dd></dl>
		</div>
	</div>
	<div id="footer">
<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
</div>

</div>
</body>
</html>